<?php
/**
 * 功能：多场景验证器
 * 作者：魏安来
 * 日期：2018/01/04
 */

namespace app\index\validate;
use think\Validate;

class User extends Validate {

	//验证规则
	protected $rule = [
		'username' => 'require|min:2',
		'password' => 'require|min:6'
	];

	//验证消息
	protected $message = [
		'username.require' => '用户名不能为空',
		'username.min' => '用户名不能少于2位',
		'password.require' => '密码不能为空',
		'password.min' => '密码不能少于6位'
	];

	//验证场景
	protected $scene = [
		'login' => ['username', 'password']
	];

}

?>